c9dfb637af44a9e8a352e12edeefc429174c2cc0,backend-service/app/models/daos/DatasetInfoDao.java,DatasetInfoDao,updateDatasetOwner,#JsonNode#,697
Before Change
public static void updateDatasetOwner(JsonNode root)
throws Exception {
final JsonNode idNode = root.path("datasetId");
final JsonNode urnNode = root.path("urn");
final JsonNode owners = root.path("owners");
final JsonNode ownerSourceNode = root.path("source");
String ownerSource = null;
if (ownerSourceNode != null && (!ownerSourceNode.isMissingNode()))
{
ownerSource = ownerSourceNode.asText();
}
if ((idNode.isMissingNode() && urnNode.isMissingNode()) || owners.isMissingNode() || !owners.isArray()) {
throw new IllegalArgumentException(
"Dataset owner info update fail, " + "Json missing necessary fields: " + root.toString());
}
After Change
final Integer datasetId;
final String urn;
final Object[] idUrn = findDataset(root);
if (idUrn[0] == null || idUrn[1] == null) {
datasetId = 0;
urn = root.path("datasetProperties").path("uri").asText();
} else {
datasetId = (Integer) idUrn[0];
urn = (String) idUrn[1];